package com.example.wechat_b.adapter;

import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.PagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author liaoqg
 * @brief description
 * @date 2021-11-01
 */
public class ViewPagerAdapter extends PagerAdapter {
    List<Fragment> fragmentList = new ArrayList<>();

    static{
//        fragmentList = new ArrayList<>();
    }

    public void ViewPagerAdapter(List<Fragment> fragmentList){
        this.fragmentList = fragmentList;
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public boolean isViewFromObject(View view,Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        return super.instantiateItem(container, position);
    }

    @Override
    public int getItemPosition(Object object) {
        return super.getItemPosition(object);
    }

    @Override
    public void destroyItem(ViewGroup container, int position,Object object) {
        container.removeView((View) object);
    }
}
